def add_word(word, word_count_dict): '''Update the word frequency: word is the key, frequency is the value.''' if word in word_count_dict: word_count_dict[word] += 1 else: word_count_dict[word] = 1